﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace C7
{
    /// <summary>
    /// Interaction logic for PencilSize.xaml
    /// </summary>
    public partial class PencilSize : UserControl
    {
        public PencilSize()
        {
            InitializeComponent();
        }

        private void StrokeSizeSelected(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            ComboBoxItem selectedComboItem = StrokeSizeComboBox.SelectedItem as ComboBoxItem;
            Canvas childCanvas = selectedComboItem.Content as Canvas;
            Rectangle sizeRectangle = childCanvas.Children[0] as Rectangle;

            InkHelper.StrokeSize = sizeRectangle.ActualHeight;
            InkHelper.EditingMode = InkCanvasEditingMode.Ink;

            try
            {
                InkHelper.MainWindow.UpdateInkCanvas();
            }
            catch
            {

            }
        }
    }
}
